package com.tx.studentManager.dao;

import org.apache.commons.lang.StringUtils;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.tx.studentManager.dao.base.HibernateGenericDao;
import com.tx.studentManager.model.Major;
import com.tx.studentManager.qo.MajorQO;
@Repository
public class MajorDao extends HibernateGenericDao<Major, String, MajorQO> {

	@Override
	protected Criteria buildCriteria(Criteria criteria, MajorQO qo) {
		//查询具有某一角色的用户
				if (StringUtils.isNotBlank(qo.getDepId())) {
					criteria.createCriteria("department").add(Restrictions.eq("depId", qo.getDepId()));
				}
		return criteria;
	}

}
